package java44th.group.service.wx.feedback;

import java44th.group.bean.po.MarketFeedback;
import java44th.group.bean.wx.vo.feedback.WxFeedbackSubmitBo;
import java44th.group.mapper.MarketFeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;

/**
 * @author 小焦
 * @since 2022/10/15 20:10
 */

@Service
public class WxFeedbackServiceImpl implements WxFeedbackService {
    @Autowired
    MarketFeedbackMapper feedbackMapper;
    @Override
    public int submit(WxFeedbackSubmitBo submitBo, Integer userId,String username) {
        MarketFeedback feedback = new MarketFeedback();
        feedback.setUserId(userId);
        feedback.setUsername(username);
        feedback.setMobile(submitBo.getMobile());
        feedback.setFeedType(submitBo.getFeedType());
        feedback.setContent(submitBo.getContent());
        feedback.setStatus(0);
        feedback.setHasPicture(submitBo.getHasPicture());
        feedback.setPicUrls(submitBo.getPicUrls());
        feedback.setAddTime(new Timestamp(System.currentTimeMillis()));
        feedback.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        feedback.setDeleted(false);
        int count = feedbackMapper.insertSelective(feedback);
        return count;
    }
}
